<?php

class Torrent_Acl extends Zend_Acl
{
	public function __construct(){
		$this->addRole(new Zend_Acl_Role('guest'));
		$this->addRole(new Zend_Acl_Role('member'),'guest');
		$this->addRole(new Zend_Acl_Role('premium'),'member');
		$this->addRole(new Zend_Acl_Role('admin'),'premium');
		
		$this->add(new Zend_Acl_Resource('index'));
		$this->add(new Zend_Acl_Resource('user'));
		$this->add(new Zend_Acl_Resource('torrent'));
		$this->add(new Zend_Acl_Resource('comment'));
		$this->add(new Zend_Acl_Resource('error'));
		
		$this->allow('guest','user','register');
		$this->allow('guest','user','login');
		$this->allow('guest','index','index');
		$this->allow('guest','torrent','show');
		
		$this->deny('member','user','login');
		$this->allow('member','torrent','add');
		$this->allow('member','comment','add');
		
		$this->allow('premium','torrent','download');
	}
}